package top.hkyzf.study.leetcode.bit;

import org.junit.Test;

/**
 * @author 朱峰
 * @date 2022-2-1 21:15
 */
public class 只出现一次的数字_136 {
    public int singleNumber(int[] nums) {
        int result = 0;
        for (int num : nums) {
            result ^= num;
        }
        return result;
    }

    @Test
    public void testSingleNumber () {
        int[] nums = {1,2,3,4,5,6,1,2,3,4,5};
        System.out.println(singleNumber(nums));
    }
}
